/* 按钮组件样式 */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
}

.btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* 按钮尺寸 */
.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 3px;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  border-radius: 6px;
}

.btn-xl {
  padding: 1rem 2rem;
  font-size: 1.2rem;
  border-radius: 8px;
}

/* 按钮颜色 */
.btn-primary {
  background: #007bff;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #0056b3;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #545b62;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #1e7e34;
}

.btn-warning {
  background: #ffc107;
  color: #212529;
}

.btn-warning:hover:not(:disabled) {
  background: #e0a800;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c82333;
}

.btn-info {
  background: #17a2b8;
  color: white;
}

.btn-info:hover:not(:disabled) {
  background: #138496;
}

.btn-light {
  background: #f8f9fa;
  color: #212529;
  border: 1px solid #dee2e6;
}

.btn-light:hover:not(:disabled) {
  background: #e2e6ea;
}

.btn-dark {
  background: #343a40;
  color: white;
}

.btn-dark:hover:not(:disabled) {
  background: #23272b;
}

/* 按钮变体 */
.btn-outline-primary {
  background: transparent;
  color: #007bff;
  border: 2px solid #007bff;
}

.btn-outline-primary:hover:not(:disabled) {
  background: #007bff;
  color: white;
}

.btn-outline-secondary {
  background: transparent;
  color: #6c757d;
  border: 2px solid #6c757d;
}

.btn-outline-secondary:hover:not(:disabled) {
  background: #6c757d;
  color: white;
}

.btn-outline-success {
  background: transparent;
  color: #28a745;
  border: 2px solid #28a745;
}

.btn-outline-success:hover:not(:disabled) {
  background: #28a745;
  color: white;
}

.btn-outline-danger {
  background: transparent;
  color: #dc3545;
  border: 2px solid #dc3545;
}

.btn-outline-danger:hover:not(:disabled) {
  background: #dc3545;
  color: white;
}

/* 相邻按钮间距 */
.btn + .btn {
  margin-left: 8px;
}

/* 按钮组 */
.btn-group {
  display: flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
  margin-left: 0;
}

.btn-group .btn:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.btn-group .btn:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.btn-group .btn:not(:first-child):not(:last-child) {
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

/* 图标按钮 */
.btn-icon {
  padding: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-sm {
  padding: 0.25rem;
  width: 2rem;
  height: 2rem;
  font-size: 0.8rem;
}

.btn-icon-lg {
  padding: 0.75rem;
  width: 3rem;
  height: 3rem;
  font-size: 1.2rem;
}

/* 加载状态 */
.btn-loading {
  position: relative;
  color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-loading 1s linear infinite;
}

@keyframes btn-loading {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 响应式按钮 */
@media (max-width: 768px) {
  .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
  
  .btn-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }
  
  .btn-lg {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
  }
  
  .btn-xl {
    padding: 0.8rem 1.6rem;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .btn + .btn {
    margin-left: 4px;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group .btn {
    border-radius: 4px !important;
    margin-bottom: 4px;
  }
  
  .btn-group .btn:last-child {
    margin-bottom: 0;
  }
}
